package com.zzxy.Test;

import java.io.IOException;
import java.io.InputStream;

import org.apache.mybatis.io.Resources;
import org.apache.mybatis.session.SqlSession;
import org.apache.mybatis.session.SqlSessionFactory;
import org.apache.mybatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;
public class Test {
    @org.junit.Test
    public void Test() throws IOException {
     InputStream is = Resources.getResourceAsStream("SqlMapConfig.xml");
        SqlSessionFactory ss = new SqlSessionFactoryBuilder().build(is);
        SqlSession sqlSession = ss.openSession();

     //    User user = sqlSession.selectOne("findUserById", 1);
     //     System.out.println(user);

     // List<User> users = sqlSession.selectList("findUserByName", "张");
     // for (User user : users) {
     // System.out.println(user);*/
     // }

       /* User user = new User();
        user.setUsername("哈哈");
        user.setBirthday(new Date());
        user.setAddress("枣庄");
        user.setSex("1");
        sqlSession.insert("insertUser", user);
        sqlSession.commit();*/

      /*  User user = new User();
        user.setUsername("王");
        user.setId(1);
        user.setSex("2");
        sqlSession.insert("updateUser", user);
        sqlSession.commit();*/



       /* sqlSession.delete("deleteUser", 20);
        sqlSession.commit();
        sqlSession.close();*/
    }
    @org.junit.Test
   public void test2(){

    }
}